//Variablen datakilde sier hvor vi henter kartdata fra
//Bruk map objektet for å kommunisere med kartet
var map ;

google.load("maps", "3", {
	other_params : "sensor=false"
});
google.load("jquery", "1.3.2");


function initialize() {
	var myLatlng = new google.maps.LatLng(58.46191127401072, 8.772218227386475);
	var myOptions = {
		zoom : 13,
		center : myLatlng,
		mapTypeId : google.maps.MapTypeId.ROADMAP
	}
	map = new google.maps.Map(document.getElementById("map_canvas"),
			myOptions);
	

	// For more information on doing XMLHR with jQuery, see these resources:
	// http://
	// net.tutsplus.com/tutorials/javascript-ajax/use-jquery-to-retrieve-data-from-an-xml-file/
	// http://marcgrabanski.com/article/jquery-makes-parsing-xml-easy
	jQuery.get(datakilde, {}, function(data) {
		jQuery(data).find("marker").each(
				function() {
					var marker = jQuery(this);
					var latlng = new google.maps.LatLng(parseFloat(marker
							.attr("lat")), parseFloat(marker.attr("lng")));
					var marker = new google.maps.Marker( {
						position : latlng,
						map : map
					});
				});
	});
}

google.setOnLoadCallback(initialize);